<?php
namespace inkstones\db;
use inkstones\config\Config;

class Connect{
	protected $config='';
	protected static $linked='';
	
	public function __construct(){
		$this->config=Config::get('mysql');
	}
	
	public function init(){
		if(!self::$linked){
			$this->config['host']=$this->config['port']?$this->config['host'].':'.$this->config['port']:$this->config['host'];
			
			$connect=$this->config['pconnect']?'mysql_pconnect':'mysql_connect';
			
			self::$linked=$connect($this->config['host'],$this->config['user'],$this->config['pwd']) or die(mysql_error());
			mysql_query('set names '.$this->config['charset']);
			mysql_select_db($this->config['dbname'],self::$linked);
		}
	}
	
	
	
	
	
	
	
	
	
}



















?>